﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="KQForm.aspx.cs" Inherits="RenShiKaoQin.Account.KQForm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server" EnableScriptGlobalization="true"
        EnableScriptLocalization="true">
</ajaxToolkit:ToolkitScriptManager>
    <asp:HiddenField ID="hfDeptCode" runat="server" />
<div align="center">
    <asp:Table ID="tableHolder" runat="server">
    </asp:Table>
    <table border="2" rules="all" cellpadding="5" width="200px"><tr style="font-size:23px;font-weight:bold"><td>请&nbsp;&nbsp;假&nbsp;&nbsp;审&nbsp;&nbsp;批</td></tr></table>
    您可以批准两天以内的假期申请：<asp:CheckBox ID="cbDisplaySP" runat="server" 
        AutoPostBack="True" />显示已经批准的申请
    <asp:GridView ID="gvKQ" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="SerialNO" DataSourceID="sqlKQ" 
        onrowupdating="gvKQ_RowUpdating" EmptyDataText="没有符合条件的数据" CellPadding="4" 
        ForeColor="#333333" GridLines="None" AllowPaging="True" Font-Size="15px" 
        onrowcommand="gvKQ_RowCommand">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="EmployeeName" HeaderText="姓名" 
                SortExpression="EmployeeName" />
            <asp:BoundField DataField="DeptName" HeaderText="科室" 
                SortExpression="DeptName" />
            <asp:BoundField DataField="TypeName" HeaderText="休假类别" 
                SortExpression="TypeName" />
            <asp:BoundField DataField="StartDate" HeaderText="起始时间" 
                SortExpression="StartDate" DataFormatString="{0:yyyy-MM-dd}" />
            <asp:BoundField DataField="EndDate" HeaderText="结束时间" 
                SortExpression="EndDate" DataFormatString="{0:yyyy-MM-dd}" />
            <asp:BoundField DataField="Memo" HeaderText="事由" SortExpression="Memo" />
            <asp:TemplateField HeaderText="审批状态">
                <ItemTemplate>
                <asp:Label ID="lbExamStatus" runat="server" Text='<%# Eval("ExamStatus").ToString().Equals("True")?"已审批":"未审批" %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="复核状态">
                <ItemTemplate>
                    <asp:Label ID="lbCheckStatus" runat="server" Text='<%# Eval("CheckStatus").ToString().Equals("True")?"已复核":"未复核" %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="阅读状态">
                <ItemTemplate>
                <asp:Label ID="lbReadStatus" runat="server" Text='<%# Eval("ReadStatus").ToString().Equals("True")?"已阅读":"未阅读" %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="审批">
            <ItemStyle Width="75px" />
                <ItemTemplate>
                    <asp:LinkButton ID="lkbSP" runat="server" CommandName="Update" Text='<%# Eval("ExamStatus").ToString().Equals("False")?"通过":"撤销" %>'></asp:LinkButton>
                    <asp:LinkButton ID="lkbDispReason" runat="server" CommandName="DispReason" Visible='<%# Eval("ExamStatus").ToString().Equals("False") %>' Text="拒绝" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'></asp:LinkButton><asp:LinkButton ID="lkbUpdate" runat="server" Visible="false" Text="确定" CommandName="UpdateReason" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'></asp:LinkButton><br />
                    <asp:TextBox ID="tbReason" runat="server" Visible="false" Width="72px"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:SqlDataSource ID="sqlKQ" runat="server" 
        ConnectionString="<%$ ConnectionStrings:hrdbConnectionString %>" 
        
        
        SelectCommand="SELECT TKQRequestRecord.FEmployeeID, TKQRequestRecord.StartDate, TKQRequestRecord.EndDate, TKQRequestRecord.TypeCode, TKQRequestRecord.Memo, TKQRequestRecord.ExamStatus, TKQRequestRecord.CheckStatus, TKQRequestRecord.SerialNO, TKQRequestRecord.ReadStatus, TKQRequestRecord.DeptCode, TEmployee.FName AS EmployeeName, TDictDept.FName AS DeptName, TDictKQType.FName AS TypeName FROM TKQRequestRecord INNER JOIN TEmployee ON TKQRequestRecord.FEmployeeID = TEmployee.FEmployeeID INNER JOIN TDictDept ON TKQRequestRecord.DeptCode = TDictDept.FDeptCode INNER JOIN TDictKQType ON TKQRequestRecord.TypeCode = TDictKQType.FKQTypeCode WHERE (TKQRequestRecord.ExamStatus = @ExamStatus) AND (DATEDIFF(hh, TKQRequestRecord.StartDate, TKQRequestRecord.EndDate) &lt;= 24) AND (TKQRequestRecord.DeptCode = @DeptCode) AND (TKQRequestRecord.TypeCode &lt; '11') AND (TKQRequestRecord.RejectStatus = 0) ORDER BY TKQRequestRecord.StartDate, EmployeeName, DeptName" 
        
        
        
        
        
        
        
        UpdateCommand="UPDATE TKQRequestRecord SET ExamStatus = @ExamStatus, CheckStatus = @CheckStatus, ReadStatus = @ReadStatus, ExamerID = @ExamerID, ExamDate = @ExamDate, CheckerID = @CheckerID, CheckDate = @CheckDate WHERE (SerialNO = @SerialNO)">
        <SelectParameters>
            <asp:ControlParameter ControlID="cbDisplaySP" Name="ExamStatus" 
                PropertyName="Checked" />
            <asp:Parameter Name="DeptCode" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="ExamStatus" />
            <asp:Parameter Name="CheckStatus" />
            <asp:Parameter Name="ReadStatus" />
            <asp:Parameter Name="ExamerID" />
            <asp:Parameter Name="ExamDate" />
            <asp:Parameter Name="CheckerID" />
            <asp:Parameter Name="CheckDate" />
            <asp:Parameter Name="SerialNO" />
        </UpdateParameters>
    </asp:SqlDataSource>

    <div style="padding-top:20px">
    <table border="2" rules="all" cellpadding="5" width="200px"><tr style="font-size:23px;font-weight:bold"><td>请&nbsp;&nbsp;假&nbsp;&nbsp;确&nbsp;&nbsp;认</td></tr></table>
    以下是您需要确认阅读过的申请：<asp:CheckBox ID="cbDisplayRead" runat="server" 
        AutoPostBack="True" />显示已经阅读的申请
    <asp:GridView ID="gvRead" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="SerialNO" DataSourceID="sqlRead" EmptyDataText="没有符合条件的数据" 
            CellPadding="4" ForeColor="#333333" GridLines="None" AllowPaging="True" 
            Font-Size="15px">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="EmployeeName" HeaderText="姓名" 
                SortExpression="EmployeeName" />
            <asp:BoundField DataField="DeptName" HeaderText="科室" 
                SortExpression="DeptName" />
            <asp:BoundField DataField="TypeName" HeaderText="休假类别" 
                SortExpression="TypeName" />
            <asp:BoundField DataField="StartDate" HeaderText="起始时间" 
                SortExpression="StartDate" DataFormatString="{0:yyyy-MM-dd}" />
            <asp:BoundField DataField="EndDate" HeaderText="结束时间" 
                SortExpression="EndDate" DataFormatString="{0:yyyy-MM-dd}" />
            <asp:BoundField DataField="Memo" HeaderText="事由" SortExpression="Memo">
                <ItemStyle Width= "200px" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="阅读状态">
                <ItemTemplate>
                <asp:Label ID="lbReadStatus" runat="server" Text='<%# Eval("ReadStatus").ToString().Equals("True")?"已阅读":"未阅读" %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="确认">
                <ItemTemplate>
                    <asp:LinkButton ID="lkbRead" runat="server" CommandName="Update" Visible='<%# !Convert.ToBoolean(Eval("ReadStatus")) %>' Text="已阅"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:SqlDataSource ID="sqlRead" runat="server" 
        ConnectionString="<%$ ConnectionStrings:hrdbConnectionString %>" 
        
        
        SelectCommand="SELECT TKQRequestRecord.FEmployeeID, TKQRequestRecord.StartDate, TKQRequestRecord.EndDate, TKQRequestRecord.TypeCode, TKQRequestRecord.Memo, TKQRequestRecord.ExamStatus, TKQRequestRecord.CheckStatus, TKQRequestRecord.SerialNO, TKQRequestRecord.ReadStatus, TKQRequestRecord.DeptCode, TEmployee.FName AS EmployeeName, TDictDept.FName AS DeptName, TDictKQType.FName AS TypeName FROM TKQRequestRecord INNER JOIN TEmployee ON TKQRequestRecord.FEmployeeID = TEmployee.FEmployeeID INNER JOIN TDictDept ON TKQRequestRecord.DeptCode = TDictDept.FDeptCode INNER JOIN TDictKQType ON TKQRequestRecord.TypeCode = TDictKQType.FKQTypeCode WHERE (TKQRequestRecord.ExamStatus = 1) AND (DATEDIFF(hh, TKQRequestRecord.StartDate, TKQRequestRecord.EndDate) &gt; 24) AND (TKQRequestRecord.DeptCode = @DeptCode) AND (TKQRequestRecord.CheckStatus = 1) AND (TKQRequestRecord.ReadStatus = @ReadStatus) AND (LEN(TKQRequestRecord.TypeCode) = 2) ORDER BY TKQRequestRecord.StartDate, EmployeeName, DeptName" 
        
        
        
        
        
            UpdateCommand="UPDATE TKQRequestRecord SET ReadStatus = 1 WHERE (SerialNO = @SerialNO)">
        <SelectParameters>
            <asp:Parameter Name="DeptCode" />
            <asp:ControlParameter ControlID="cbDisplayRead" Name="ReadStatus" 
                PropertyName="Checked" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="SerialNO" />
        </UpdateParameters>
    </asp:SqlDataSource>
    </div>
    <div style="padding-top:20px">
    <div id="divZhiNong" style="border:2px solid black;width:400px;font-size:23px;font-weight:bold;height:35px;vertical-align:middle;line-height:35px;cursor:pointer;">外出人员&nbsp;&nbsp;<asp:Label ID="lbZhiNong" runat="server"></asp:Label></div>
    <asp:Panel ID="panelZhiNong" runat="server">
        <asp:GridView ID="gvOut" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataSourceID="sqlOut" ForeColor="#333333" GridLines="None" 
            AllowPaging="True" Font-Size="15px">
            <AlternatingRowStyle BackColor="White" />
            <Columns><asp:BoundField DataField="EmployeeName" HeaderText="姓名" 
                SortExpression="EmployeeName" />
            <asp:BoundField DataField="DeptName" HeaderText="科室" 
                SortExpression="DeptName" />
            <asp:BoundField DataField="TypeName" HeaderText="类别" 
                SortExpression="TypeName" />
            <asp:BoundField DataField="StartDate" HeaderText="起始时间" 
                SortExpression="StartDate" DataFormatString="{0:yyyy-MM-dd}" />
            <asp:BoundField DataField="EndDate" HeaderText="结束时间" 
                SortExpression="EndDate" DataFormatString="{0:yyyy-MM-dd}" />
            <asp:BoundField DataField="Memo" HeaderText="地点" SortExpression="Memo">
            </asp:BoundField>
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        <asp:SqlDataSource ID="sqlOut" runat="server" 
            ConnectionString="<%$ ConnectionStrings:hrdbConnectionString %>" 
            
            
            SelectCommand="SELECT TKQRequestRecord.FEmployeeID, TKQRequestRecord.StartDate, TKQRequestRecord.EndDate, TKQRequestRecord.TypeCode, TKQRequestRecord.Memo, TKQRequestRecord.ExamStatus, TKQRequestRecord.CheckStatus, TKQRequestRecord.SerialNO, TKQRequestRecord.ReadStatus, TKQRequestRecord.DeptCode, TKQRequestRecord.CheckerID, TKQRequestRecord.ExamerID, TKQRequestRecord.CheckDate, TKQRequestRecord.ExamDate, TKQRequestRecord.RejectStatus, TKQRequestRecord.RejectReason, TDictDept.FName AS DeptName, TEmployee.FName AS EmployeeName, TDictKQType.FName AS TypeName FROM TKQRequestRecord INNER JOIN TDictDept ON TDictDept.FDeptCode = TKQRequestRecord.DeptCode INNER JOIN TEmployee ON TKQRequestRecord.FEmployeeID = TEmployee.FEmployeeID INNER JOIN TDictKQType ON TDictKQType.FKQTypeCode = TKQRequestRecord.TypeCode WHERE (TKQRequestRecord.DeptCode = @DeptCode) AND (TKQRequestRecord.TypeCode = '1901') UNION ALL SELECT TKQRequestRecord_1.FEmployeeID, TKQRequestRecord_1.StartDate, TKQRequestRecord_1.EndDate, TKQRequestRecord_1.TypeCode, TKQRequestRecord_1.Memo, TKQRequestRecord_1.ExamStatus, TKQRequestRecord_1.CheckStatus, TKQRequestRecord_1.SerialNO, TKQRequestRecord_1.ReadStatus, TKQRequestRecord_1.DeptCode, TKQRequestRecord_1.CheckerID, TKQRequestRecord_1.ExamerID, TKQRequestRecord_1.CheckDate, TKQRequestRecord_1.ExamDate, TKQRequestRecord_1.RejectStatus, TKQRequestRecord_1.RejectReason, TDictDept_1.FName AS DeptName, TEmployee_1.FName AS EmployeeName, TDictKQType_1.FName AS TypeName FROM TKQRequestRecord AS TKQRequestRecord_1 INNER JOIN TKQConsultationRecord ON TKQRequestRecord_1.SerialNO = TKQConsultationRecord.SerialNO INNER JOIN TDictDept AS TDictDept_1 ON TDictDept_1.FDeptCode = TKQRequestRecord_1.DeptCode INNER JOIN TEmployee AS TEmployee_1 ON TKQRequestRecord_1.FEmployeeID = TEmployee_1.FEmployeeID INNER JOIN TDictKQType AS TDictKQType_1 ON TDictKQType_1.FKQTypeCode = TKQRequestRecord_1.TypeCode WHERE (TKQRequestRecord_1.DeptCode = @DeptCode) AND (TKQRequestRecord_1.TypeCode = '1801') OR (TKQRequestRecord_1.DeptCode = @DeptCode) AND (TKQRequestRecord_1.TypeCode = '1802')"
            
            
            UpdateCommand="UPDATE TKQRequestRecord SET ReadStatus = 1 WHERE (SerialNO = @SerialNO)">

            <SelectParameters>
                <asp:Parameter Name="DeptCode" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="SerialNO" />
            </UpdateParameters>
        </asp:SqlDataSource>
        </asp:Panel>
        <ajaxToolkit:CollapsiblePanelExtender runat="server" CollapsedText="（点击展开...）" ID="cpeZhiNong"
        TargetControlID="panelZhiNong" CollapseControlID="divZhiNong" 
        ExpandControlID="divZhiNong" TextLabelID="lbZhiNong" ExpandedText="（点击收起...）" 
            Collapsed="True"></ajaxToolkit:CollapsiblePanelExtender>
    </div>
    <div style="padding-top:20px">
    <table border="2" rules="all" cellpadding="5" width="200px"><tr style="font-size:23px;font-weight:bold"><td>数&nbsp;&nbsp;据&nbsp;&nbsp;导&nbsp;&nbsp;出</td></tr></table>
    <asp:LinkButton ID="lkbExport" 
        runat="server" Text="数据导出" onclick="lkbExport_Click"></asp:LinkButton>
    </div>
</div>
</asp:Content>